package com.turing.post.salesmanage.util;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

/**
 * @销售单状态迁移明细
 * @author zxl
 * @date 2012-12-17
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "SALEORDERACTIONDETAIL")
@IdClass(SaleOrderActionDetail.class)
public class SaleOrderActionDetail implements Serializable {
	/**
	 * 操作类型 结束录入
	 */
	public static final String ACTIONTYPE_ENDINPUT = "0";
	/**
	 * 操作类型 付清销售款
	 */
	public static final String ACTIONTYPE_PAIDSALESMONEY = "1";
	/**
	 * 操作类型 付清销售款撤销
	 */
	public static final String ACTIONTYPE_PAIDSALESMONEYCANCEL = "8";
	/**
	 * 操作类型 销售出库
	 */
	public static final String ACTIONTYPE_OUTOFLIBRARY = "2";

	/**
	 * 操作类型 打包上送
	 */
	public static final String ACTIONTYPE_put = "p";
	/**
	 * 审核资金
	 */
	public static final String ACTIONTYPE_authMoney= "m";
	/**
	 * 审核卡
	 */
	public static final String ACTIONTYPE_authCard = "a";
	/**
	 * 库管审核
	 */
	public static final String ACTIONTYPE_authStock = "s";

	/**
	 * 操作类型 销售确认提交激活
	 */
	public static final String ACTIONTYPE_SALESCONFIRM = "3";
	/**
	 * 操作类型 提请审核
	 */
	public static final String ACTIONTYPE_DREWAUDIT = "4";
	/**
	 * 操作类型 确认激活
	 */
	public static final String ACTIONTYPE_CONFIRMACTIVATION = "5";
	/**
	 * 操作类型 取消激活
	 */
	public static final String ACTIONTYPE_DEACTIVATE = "6";
	/**
	 * 操作类型 取消出库
	 */
	public static final String ACTIONTYPE_CANCELOUTOFLIBRARY = "7";
	/**
	 * 操作类型 冻结
	 */
	public static final String ACTIONTYPE_FREEZE = "D";
	/**
	 * 操作类型 解除冻结
	 */
	public static final String ACTIONTYPE_UNDOFREEZE = "J";
	/**
	 * 操作类型 取消销售单
	 */
	public static final String ACTIONTYPE_CANCELEDORDERS = "C";
	/**
	 * 操作类型 录入确认后返回录入状态 销售单撤销
	 */
	public static final String ACTIONTYPE_BACKTOINPUT = "9";

	/**
	 * 销售单ID
	 */
	private BigInteger saleOrderId;
	/**
	 * 操作时间
	 */
	private Date actionTime;
	/**
	 * 操作员ID
	 */
	private BigInteger operId;
	/**
	 * 初始状态
	 */
	private String initialStatus;
	/**
	 * 结束状态
	 */
	private String endStatus;
	/**
	 * 操作类型
	 */
	private String actionType;
	/**
	 * 备注
	 */
	private String remark;

	public SaleOrderActionDetail() {
		super();
	}

	@Id
	@Column(name = "SALEORDERID", nullable = false)
	public BigInteger getSaleOrderId() {
		return saleOrderId;
	}

	public void setSaleOrderId(BigInteger saleOrderId) {
		this.saleOrderId = saleOrderId;
	}

	@Id
	@Column(name = "ACTIONTIME", nullable = false)
	public Date getActionTime() {
		return actionTime;
	}

	public void setActionTime(Date actionTime) {
		this.actionTime = actionTime;
	}

	@Column(name = "OPERID", nullable = false)
	public BigInteger getOperId() {
		return operId;
	}

	public void setOperId(BigInteger operId) {
		this.operId = operId;
	}

	@Column(name = "INITIALSTATUS")
	public String getInitialStatus() {
		return initialStatus;
	}

	public void setInitialStatus(String initialStatus) {
		this.initialStatus = initialStatus;
	}

	@Column(name = "ENDSTATUS", nullable = false)
	public String getEndStatus() {
		return endStatus;
	}

	public void setEndStatus(String endStatus) {
		this.endStatus = endStatus;
	}

	@Column(name = "ACTIONTYPE", nullable = false)
	public String getActionType() {
		return actionType;
	}

	public void setActionType(String actionType) {
		this.actionType = actionType;
	}

	@Column(name = "REMARK")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime
				* result
				+ ((this.getActionTime() == null) ? 0 : this.getActionTime()
						.hashCode());
		result = prime
				* result
				+ ((this.getSaleOrderId() == null) ? 0 : this.getSaleOrderId()
						.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final SaleOrderActionDetail other = (SaleOrderActionDetail) obj;
		if (this.getActionTime() == null) {
			if (other.getActionTime() != null)
				return false;
		} else if (!this.getActionTime().equals(other.getActionTime()))
			return false;
		if (this.getSaleOrderId() == null) {
			if (other.getSaleOrderId() != null)
				return false;
		} else if (!this.getSaleOrderId().equals(other.getSaleOrderId()))
			return false;
		return true;
	}
}
